﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using RpcService.Api1Service;
using RpcService.Api1Service.Dto;

namespace M.ServiceApi1.Service
{
    public class UserServiceImpl : IUserService.IAsync
    {
        public Task<List<User>> GetAllUserAsync(CancellationToken cancellationToken)
        {
            return Task.Factory.StartNew<List<User>>(()=> {
                List<User> list = new List<User>();
                User user = new User();
                user.ID = 1;
                user.Name = "User";
                user.Password = "1234561";
                list.Add(user);

                return list;
            });           
        }

        public Task<User> GetUserByIDAsync(int userID, CancellationToken cancellationToken)
        {
            return Task.Factory.StartNew<User>(() => {
                User user = new User();
                user.ID = 1;
                user.Name = "User";
                user.Password = "1234561";

                return user;
            });
        }
    }
}
